﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml.Linq;
using PlaydeezGames.Common;

namespace IslandInterloper.Engine
{
    internal class Ships : GameClientCollectionStringKeyed<Ship>
    {
        internal Ships(Game theGame, XElement element)
            : base(theGame, element)
        {
        }
        public string GenerateShip()
        {
            WeightedGenerator<string> generator = new WeightedGenerator<string>();
            foreach (string shipName in Keys)
            {
                generator[shipName] = this[shipName].AvatarChance;
            }
            return generator.Generate();
        }

        protected override Ship LoadItemFromXElement(XElement element)
        {
            return new Ship(Game, element);
        }
    }
}
